home *** CD-ROM | disk | FTP | other *** search
-
-
-
- Fs_Dispatch C Library Procedures Fs_Dispatch
-
-
-
- _________________________________________________________________
-
- NNAAMMEE
- Fs_Dispatch, Fs_EventHandlerCreate, Fs_EventHandlerDestroy,
- Fs_EventHandlerData, Fs_EventHandlerChangeData,
- Fs_TimeoutHandlerCreate, Fs_TimeoutHandlerDestroy - stream
- event and timeout dispatcher routines.
-
- SSYYNNOOPPSSIISS
- ##iinncclluuddee <<ffss..hh>>
-
- void
- FFss__DDiissppaattcchh()
-
- void
- FFss__EEvveennttHHaannddlleerrCCrreeaattee(_s_t_r_e_a_m_I_D, _e_v_e_n_t_M_a_s_k, _p_r_o_c, _c_l_i_e_n_t_D_a_t_a)
-
- void
- FFss__EEvveennttHHaannddlleerrDDeessttrrooyy(_s_t_r_e_a_m_I_D)
-
- void
- FFss__EEvveennttHHaannddlleerrDDaattaa(_s_t_r_e_a_m_I_D)
-
- ClientData
- FFss__EEvveennttHHaannddlleerrCChhaannggeeDDaattaa(_s_t_r_e_a_m_I_D, _c_l_i_e_n_t_D_a_t_a)
-
- ##iinncclluuddee <<ttiimmee..hh>>
-
- Fs_TimeoutHandler
- FFss__TTiimmeeoouuttHHaannddlleerrCCrreeaattee(_t_i_m_e, _r_e_l_a_t_i_v_e_T_i_m_e, _p_r_o_c, _c_l_i_e_n_t_D_a_t_a)
-
- void
- FFss__TTiimmeeoouuttHHaannddlleerrDDeessttrrooyy(ttookkeenn)
-
-
- AARRGGUUMMEENNTTSS
- int _s_t_r_e_a_m_I_D (in) Specifies the
- stream to
- create an event
- handler for.
-
- int _e_v_e_n_t_M_a_s_k (in) Mask indicating
- which events on
- _s_t_r_e_a_m_I_D are to
- be processed by
- _p_r_o_c. Can be
- the bitwise OR
- of FFSS__RREEAADDAABBLLEE,
- FFSS__WWRRIITTAABBLLEE and
- FFSS__EEXXCCEEPPTTIIOONN.
-
- void (*_p_r_o_c)() (in) Procedure to
-
-
-
- Sprite v.1.0 Printed: April 5, 1989 1
-
-
-
-
-
-
- Fs_Dispatch C Library Procedures Fs_Dispatch
-
-
-
- invoke when one
- of the events
- in _e_v_e_n_t_M_a_s_k
- occurs on a
- stream or when
- a timeout
- period expires.
-
- ClientData _c_l_i_e_n_t_D_a_t_a (in) Uninterpreted
- value passed to
- _p_r_o_c when it is
- invoked.
-
- Time _t_i_m_e (in) The absolute
- time when _p_r_o_c
- should be
- called or the
- time interval
- between calls
- to _p_r_o_c.
-
- Boolean _r_e_l_a_t_i_v_e_T_i_m_e (in) If TTRRUUEE, then
- _t_i_m_e specifies
- a interval
- between calls
- to _p_r_o_c. If
- FFAALLSSEE, then
- _t_i_m_e specifies
- the absolute
- time when _p_r_o_c
- should be
- called.
-
- Fs_TimeoutHandler _t_o_k_e_n (in) A token to
- identify a par-
- ticular timeout
- handler so it
- can be des-
- troyed.
-
- _________________________________________________________________
-
- DDEESSCCRRIIPPTTIIOONN
- These routines implement a dispatcher for events on streams
- and timeouts. An event occurs when the stream becomes read-
- able, writable or has an exception condition pending. The
- dispatcher handles the details of waiting for events to
- occur on streams. When an event occurs, the dispatcher calls
- a routine supplied by the clients to deal with the event.
- Also, timeout handlers can be created so that a client-
- supplied routine can be called at a specific time or at reg-
- ular intervals.
-
- The dispatcher must be initialized by calling
-
-
-
- Sprite v.1.0 Printed: April 5, 1989 2
-
-
-
-
-
-
- Fs_Dispatch C Library Procedures Fs_Dispatch
-
-
-
- FFss__EEvveennttHHaannddlleerrCCrreeaattee and/or FFss__TTiimmeeoouuttHHaannddlleerrCCrreeaattee before
- FFss__DDiissppaattcchh is called. FFss__DDiissppaattcchh causes the process to
- wait until an event occurs on a stream or until a time-out
- occurs. At that point, it calls the appropriate handler.
- Once the handler completes, FFss__DDiissppaattcchh returns to its
- caller. To have the dispatcher remain in control, do
-
- while (TRUE) {
- Fs_Dispatch();
- }
-
- FFss__EEvveennttHHaannddlleerrCCrreeaattee is used to cause the procedure _p_r_o_c to
- be called when one or more of the events in _e_v_e_n_t_M_a_s_k occur
- on _s_t_r_e_a_m_I_D. Only one procedure may be attached to a stream
- so it should be able to deal with all of the event types.
- _P_r_o_c should be declared as:
-
- void
- proc(clientData, streamID, eventMask)
- ClientData clientData;
- int streamID;
- int eventMask;
- {
- }
- FFss__EEvveennttHHaannddlleerrDDaattaa can be used to get the _c_l_i_e_n_t_D_a_t_a asso-
- ciated with _s_t_r_e_a_m_I_D. FFss__EEvveennttHHaannddlleerrCChhaannggeeDDaattaa can be used
- to change the _c_l_i_e_n_t_D_a_t_a associated with _s_t_r_e_a_m_I_D. The
- handler can be destroyed with FFss__EEvveennttHHaannddlleerrDDeessttrrooyy.
-
- In addition, a time-out routine can be setup to be called
- using FFss__TTiimmeeoouuttHHaannddlleerrCCrreeaattee. If _r_e_l_a_t_i_v_e_T_i_m_e is TTRRUUEE, then
- _t_i_m_e specifies an interval (e.g. one hour) from the current
- time that _p_r_o_c will be called at. When _p_r_o_c returns, it
- will automatically be rescheduled to be called at the next
- interval. If _p_r_o_c doesn't need to be called again, it should
- call FFss__TTiimmeeoouuttHHaannddlleerrDDeessttrrooyy. If _r_e_l_a_t_i_v_e_T_i_m_e is FFAALLSSEE,
- then _t_i_m_e specifies a specific time (e.g., 3:15pm 17 Sept.
- 1987) that _p_r_o_c will be called at. _P_r_o_c is called once - it
- is not automatically rescheduled to be called again. How-
- ever, it could call FFss__TTiimmeeoouuttHHaannddlleerrCCrreeaattee to cause it to
- be called again. _P_r_o_c should be declared as:
-
- void
- proc(clientData, time)
- ClientData clientData;
- Time Time;
- {
- }
- For example, to have EExxaammpplleeRRoouuttiinnee called in 1 minute from
- now and every minute after that, the call should be:
-
- Fs_TimeoutHandlerCreate(time_OneMinute, TRUE, ExampleRoutine, clientData);
-
-
-
- Sprite v.1.0 Printed: April 5, 1989 3
-
-
-
-
-
-
- Fs_Dispatch C Library Procedures Fs_Dispatch
-
-
-
- FFss__TTiimmeeoouuttHHaannddlleerrCCrreeaattee returns a token that must be saved
- if FFss__TTiimmeeoouuttHHaannddlleerrDDeessttrrooyy is to be called.
-
-
- KKEEYYWWOORRDDSS
- callback, client data, dispatcher, stream ID, time
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Sprite v.1.0 Printed: April 5, 1989 4
-
-
-
-